{template 'header'}
<style>
    * {
        touch-action: pan-y;
    }

    .medai_list .tish {
        position: absolute;
        right: 10px;
        bottom: 8px;
    }

    .mui-table-view-cell .time {
        position: absolute;
        top: 1%;
        right: 1%;
    }

    .mui-table-view-cell h4 {
        font-weight: 300;
        font-size: 14px;
    }

    .mui-table-view-cell h4 span {
        font-size: 16px;
        font-weight: 600;
    }
</style>
</head>
<body>
<div class="mui-content mui-scroll-wrapper">
    <div class="mui-scroll">
        <!-- 提现列表 开始-->
        <ul class="mui-table-view mui-table-view-striped mui-table-view-condensed" id="list-content">

        </ul>
        <!-- 提现列表 结束-->
    </div>
</div>
<script id="list-template" type="text/html">
    {{each list}}
    <li class="mui-table-view-cell">
        <div class="mui-table">
            <div class="mui-table-cell mui-col-xs-10">
                <h4>提现金额:<span class="mui-badge-danger mui-badge-inverted"> {{$value.cash_money}} </span>元</h4>
                <h5><span class="">{{$value.create_time}}</span></h5>
                <p class="time">{{$value.cash_state}}</p>
            </div>
        </div>
    </li>
    {{/each}}
</script>
<script src="{MODULE_URL}assets/js/jquery.min.js"></script>
<script src="{MODULE_URL}assets/js/mui.min.js"></script>
<script src="{MODULE_URL}assets/js/template-web.js"></script>
<!-- 以上为引入第三方插件 -->
<script>
    //初始化 mui 顶部 tab 效果
    var page = 1;
    var list_url = '{php echo $this->createMobileUrl("member",array("op"=>"cashout_list"))}';
    mui.ajax(list_url,{
        data:{page:1},
        dataType:'json',//服务器返回json格式数据
        type:'post',//HTTP请求类型
        async: false,
        timeout:10000,//超时时间设置为10秒；
        success:function(ret){
            if(ret.data.length>0){
                var data = {
                    list: ret.data
                };
                var html = template('list-template', data);
            }else{
                var html = '<div class="mui-pull-bottom-pocket mui-block mui-visibility"><div class="mui-pull"><div class="mui-pull-loading mui-icon mui-spinner mui-hidden"></div><div class="mui-pull-caption mui-pull-caption-nomore">没有更多数据了</div></div></div>'
            }
            $('#list-content').html(html);
            page = 2;
        },
        error:function(xhr,type,errorThrown){
            //异常处理；
            mui.alert(errorThrown);
        }
    });
    mui.init({
        pullRefresh: {
            container: "#main",
            // 下拉刷新
            down: {
                style: 'circle',
                callback: function () {
                    setTimeout(function () {
                        mui('#main').pullRefresh().endPulldownToRefresh();
                        mui.ajax(list_url,{
                            data:{page:1},
                            dataType:'json',//服务器返回json格式数据
                            type:'post',//HTTP请求类型
                            async: false,
                            timeout:10000,//超时时间设置为10秒；
                            success:function(ret){
                                var data = {
                                    list: ret.data
                                };
                                var html = template('list-template', data);
                                $('#list-content').html(html);
                                page = 2;
                            },
                            error:function(xhr,type,errorThrown){
                                //异常处理；
                                mui.alert(errorThrown);
                            }
                        });
                    }, 1500);
                }
            },
            // 上拉加载
            up: {
                contentrefresh: "正在加载...",
                contentnomore: "没有更多数据了",
                auto:true,
                callback: function (e) {
                    setTimeout(function () {
                        mui.ajax(list_url,{
                            data:{page:page},
                            dataType:'json',//服务器返回json格式数据
                            type:'post',//HTTP请求类型
                            async: false,
                            timeout:10000,//超时时间设置为10秒；
                            success:function(ret){
                                if(ret.data.length>0){
                                    var data = {
                                        list: ret.data
                                    };
                                    mui('#main').pullRefresh().endPullupToRefresh(false); //有数据穿 false 反之 true
                                    var html = template('list-template', data);
                                    $('#list-content').append(html);
                                    page ++ ;
                                }else{
                                    mui('#main').pullRefresh().endPullupToRefresh(true); //有数据穿 false 反之 true
                                }
                            },
                            error:function(xhr,type,errorThrown){
                                //异常处理；
                                mui.alert(errorThrown);
                            }
                        });
                    }, 1500)
                }
            }
        }
    });
</script>
</body>

</html>
